home *** CD-ROM | disk | FTP | other *** search
- head 1.1;
- branch ;
- access ;
- symbols ;
- locks mendel:1.1; strict;
- comment @ * @;
-
-
- 1.1
- date 89.06.20.10.51.28; author mendel; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @
- /*
- * @@(#)idprom.c 1.4 88/02/08
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
- #include "../h/idprom.h"
-
- /*
- * Read the ID prom and check it.
- * Arguments are a format number and an address to store prom contents at.
- *
- * Result is format number if prom has the right format and good checksum.
- * Result is -1 if prom has the right format and bad checksum.
- * Result is prom's format if prom has the wrong format.
- *
- * If the PROM is in the wrong format, the addressed area is not changed.
- *
- * This routine must know the size, and checksum algorithm, of each format.
- * (Currently there's only one.)
- */
-
- int
- idprom(format, idp)
- unsigned char format;
- register struct idprom *idp;
- {
- unsigned char *cp, sum=0, promform;
- short i;
-
- getidprom(&promform, 1); /* Get format byte */
- if (format != promform)
- return promform;
- getidprom((unsigned char *)idp, sizeof(*idp)); /* The whole thing */
- cp = (unsigned char *)idp;
- for (i=0; i<16; i++)
- sum ^= *cp++;
- if (sum != 0)
- return -1;
- return promform;
- }
- @
-